package com.trkj.pojo;

import java.io.Serializable;
import javax.persistence.*;

import com.alibaba.fastjson.annotation.JSONField;

import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;


/**
 * The persistent class for the CERTIFICATE_REGISTRATION database table.
 * 
 */
@Entity
@Table(name="CERTIFICATE_REGISTRATION")
@NamedQuery(name="CertificateRegistration.findAll", query="SELECT c FROM CertificateRegistration c")
public class CertificateRegistration implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="CERTIFICATE_REGISTRATION_CERTIFICATEID_GENERATOR", sequenceName="HR")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CERTIFICATE_REGISTRATION_CERTIFICATEID_GENERATOR")
	@Column(name="CERTIFICATE_ID")
	private long certificateId;

	@Column(name="CERTIFICATE_ENDDATE")
	private Timestamp certificateEnddate;

	@Column(name="CERTIFICATE_LIFE")
	private BigDecimal certificateLife;

	@Column(name="CERTIFICATE_PERSON")
	private String certificatePerson;

	@Column(name="CERTIFICATE_PURPOSE")
	private String certificatePurpose;

	@Column(name="CERTIFICATE_STARTDATE")
	private Timestamp certificateStartdate;

	@Column(name="CERTIFICATE_STATE")
	private BigDecimal certificateState;

	//bi-directional many-to-one association to BorrowedRecord
	@OneToMany(mappedBy="certificateRegistration")
	@JSONField(serialize=false)
	private List<BorrowedRecord> borrowedRecords;

	//bi-directional many-to-one association to Certificate
	@ManyToOne
	@JoinColumn(name="CERTI_ID")
	private Certificate certificate;

	//bi-directional many-to-one association to StaffInformation
	@ManyToOne
	@JoinColumn(name="STAIN_ID")
	private StaffInformation staffInformation;

	public CertificateRegistration() {
	}

	public long getCertificateId() {
		return this.certificateId;
	}

	public void setCertificateId(long certificateId) {
		this.certificateId = certificateId;
	}

	public Timestamp getCertificateEnddate() {
		return this.certificateEnddate;
	}

	public void setCertificateEnddate(Timestamp certificateEnddate) {
		this.certificateEnddate = certificateEnddate;
	}

	public BigDecimal getCertificateLife() {
		return this.certificateLife;
	}

	public void setCertificateLife(BigDecimal certificateLife) {
		this.certificateLife = certificateLife;
	}

	public String getCertificatePerson() {
		return this.certificatePerson;
	}

	public void setCertificatePerson(String certificatePerson) {
		this.certificatePerson = certificatePerson;
	}

	public String getCertificatePurpose() {
		return this.certificatePurpose;
	}

	public void setCertificatePurpose(String certificatePurpose) {
		this.certificatePurpose = certificatePurpose;
	}

	public Timestamp getCertificateStartdate() {
		return this.certificateStartdate;
	}

	public void setCertificateStartdate(Timestamp certificateStartdate) {
		this.certificateStartdate = certificateStartdate;
	}

	public BigDecimal getCertificateState() {
		return this.certificateState;
	}

	public void setCertificateState(BigDecimal certificateState) {
		this.certificateState = certificateState;
	}

	public List<BorrowedRecord> getBorrowedRecords() {
		return this.borrowedRecords;
	}

	public void setBorrowedRecords(List<BorrowedRecord> borrowedRecords) {
		this.borrowedRecords = borrowedRecords;
	}

	public BorrowedRecord addBorrowedRecord(BorrowedRecord borrowedRecord) {
		getBorrowedRecords().add(borrowedRecord);
		borrowedRecord.setCertificateRegistration(this);

		return borrowedRecord;
	}

	public BorrowedRecord removeBorrowedRecord(BorrowedRecord borrowedRecord) {
		getBorrowedRecords().remove(borrowedRecord);
		borrowedRecord.setCertificateRegistration(null);

		return borrowedRecord;
	}

	public Certificate getCertificate() {
		return this.certificate;
	}

	public void setCertificate(Certificate certificate) {
		this.certificate = certificate;
	}

	public StaffInformation getStaffInformation() {
		return this.staffInformation;
	}

	public void setStaffInformation(StaffInformation staffInformation) {
		this.staffInformation = staffInformation;
	}

}